package com.elcom.roaming.module.synthesis.pr;

import com.elcom.roaming.common.util.match.Matching;
import com.elcom.roaming.common.util.match.ObjectInput;
import com.elcom.roaming.module.synthesis.match.MSRNMatchingObjects;
import com.elcom.roaming.module.synthesis.match.MSRNMessage;

public class PRMatching extends Matching{

	MSRNMatchingObjects msrnMatching;
	
	public PRMatching(MSRNMatchingObjects msrnMatching) {
		this.msrnMatching = msrnMatching;
	}

	@Override
	public void forward(ObjectInput obj) {
		PRKey key = (PRKey) obj.getKey();
		PRValue value = (PRValue) obj.getValue();
		PRValue dropValue = (PRValue) obj.getDropValue();
		
		if (value.getType() == dropValue.getType()) return ;
		
		MSRNMessage msrnMsg = new MSRNMessage(key.seq, "P0", key.getPutTime(), value.msrn, null, dropValue.imsi, dropValue.msisdn);

		logger.info("Matching PRN on MSRN Map:" + obj.toString());
		msrnMatching.match(msrnMsg);		
	}

}
